<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>wterrain</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="writescratch.html" title="writescratch" />
    <link rel="next" href="xadsr.html" title="xadsr" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">wterrain</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="writescratch.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="xadsr.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="wterrain"></a>
      <div class="titlepage"></div>
      <a id="IndexWterrain" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">wterrain</span>
        </h2>
        <p>wterrain — 
      A simple wave-terrain synthesis opcode.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp168672768"></a>
        <h2>Description</h2>
        <p>
      A simple wave-terrain synthesis opcode.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168674096"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">aout <span class="command"><strong>wterrain</strong></span> kamp, kpch, k_xcenter, k_ycenter, k_xradius, k_yradius, \
      itabx, itaby</pre>
      </div>
      <div class="refsect1">
        <a id="idp168740480"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>itabx, itaby</em></span> -- The two tables that define the terrain.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168742160"></a>
        <h2>Performance</h2>
        <p>
      The output is the result of drawing an ellipse with axes <span class="emphasis"><em>k_xradius</em></span> and <span class="emphasis"><em>k_yradius</em></span> centered at (<span class="emphasis"><em>k_xcenter</em></span>, <span class="emphasis"><em>k_ycenter</em></span>), and traversing it at frequency <span class="emphasis"><em>kpch</em></span>.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168745600"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the wterrain opcode. It uses the file <a class="ulink" href="examples/wterrain.csd" target="_top"><em class="citetitle">wterrain.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp168747456"></a>
          <p class="title">
            <strong>Example 1053. Example of the wterrain opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o wterrain.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="oblock">instr</span> 1
kdclk   <span class="opc">linseg</span>  0, 0.01, 1, p3<span class="op">-</span>0.02, 1, 0.01, 0
kcx     <span class="opc">line</span>    0.1, p3, 1.9
krx     <span class="opc">linseg</span>  0.1, p3<span class="op">/</span>2, 0.5, p3<span class="op">/</span>2, 0.1
kpch    <span class="opc">line</span>    <span class="opc">cpspch</span>(p4), p3, p5 <span class="op">*</span> <span class="opc">cpspch</span>(p4)
a1      <span class="opc">wterrain</span>    10000, kpch, kcx, kcx, <span class="op">-</span>krx, krx, p6, p7
a1      <span class="opc">dcblock</span> a1
        <span class="opc">out</span>     a1<span class="op">*</span>kdclk
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">f</span>1      0       8192    10      1 0 0.33 0 0.2 0 0.14 0 0.11
<span class="stamnt">f</span>2      0       4096    10      1

<span class="stamnt">i</span>1      0       4       7.00 1 1 1
<span class="stamnt">i</span>1      4       4       6.07 1 1 2
<span class="stamnt">i</span>1      8       8       6.00 1 2 2
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168751776"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Matthew Gillard</td>
          </tr>
          <tr>
            <td>New in version 4.19</td>
          </tr>
        </table>
        <p>
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="writescratch.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="xadsr.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">writescratch </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> xadsr</td>
        </tr>
      </table>
    </div>
  </body>
</html>
